package com.maple.visit;

import com.alibaba.druid.sql.ast.statement.SQLSelect;
import com.alibaba.druid.sql.ast.statement.SQLSelectStatement;
import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitorAdapter;
import lombok.Getter;

/**
 * 仅访问一个节点就阻止继续
 *
 * @author maple
 * @version 1.0
 * @since 2020-11-27 00:25
 */
@Getter
public class OnlyOneNodeVisitor extends MySqlASTVisitorAdapter {

    @Override
    public boolean visit(SQLSelectStatement x) {
        System.out.println("SQLSelectStatement");
        return false;
    }

    @Override
    public boolean visit(SQLSelect x) {
        System.out.println("SQLSelect");
        return super.visit(x);
    }
}
